import { Module, forwardRef, Global } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { BullModule } from '@nestjs/bull';
import { HttpModule } from '@nestjs/axios';

// entities
import {
  CertificateEntity,
  CertificateVersionEntity,
  CertificateAccountEntity,
  CertificateDetailEntity,
} from './entities';
import { CertificateService } from './certificate.service';

import {
  CloudModule,
  UserModule,
  DnsModule,
  NotificationModule,
} from '@app/modules';

@Module({
  imports: [
    HttpModule,
    forwardRef(() => UserModule),
    forwardRef(() => DnsModule),
    forwardRef(() => CloudModule),
    forwardRef(() => NotificationModule),
    TypeOrmModule.forFeature([
      CertificateEntity,
      CertificateVersionEntity,
      CertificateAccountEntity,
      CertificateDetailEntity,
    ]),
    BullModule.registerQueue({
      name: 'certificate',
    }),
  ],
  controllers: [],
  providers: [CertificateService],
  exports: [CertificateService],
})
@Global()
export class CertificateModule {}
